package com.wzb.provider.service.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

public class Test {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        int i=0;
        boolean flag = true;
        while (true){
            try{
                list.add(i);
                i++;
            } finally {
                if(flag){
                    new Timer().schedule(new TimerTask() {
                        @Override
                        public void run() {
                            System.out.println(list.toString());
                        }
                    },5000);
                    flag=false;
                }

            }
        }


    }
}
